package com.turing.post.transaction.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

/**
 * 商户交易附加流水
 * 
 * @author zxl
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "MCHADDTRADSUMMARY")
@IdClass(MchAddTradSummary.class)
public class MchAddTradSummary implements Serializable {
	/**
	 * 商户ID
	 */
	private String merchantNo;
	/**
	 * 帐务日期
	 */
	private Date tranDate;
	/**
	 * 流水号
	 */
	private String tranSeqNo;
	/**
	 * 商户分支机构编号
	 */
	private String mrchBrchNo;
	/**
	 * 商户分支机构名称
	 */
	private String mrchBrchName;
	/**
	 * 商户操作员编号
	 */
	private String mrchTellerNo;
	/**
	 * 商户操作员名称
	 */
	private String mrchTellerName;
	/**
	 * 商户账单明细条数
	 */
	private Integer mrchProdDetailNum;
	/**
	 * 其他方式支付金额
	 */
	private BigInteger mrchOtherPaidAmount;
	/**
	 * 卡金额
	 */
	private BigInteger mrchAmount;

	public MchAddTradSummary() {
		super();
	}

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Id
	@Column(name = "TRANSEQNO", nullable = false)
	public String getTranSeqNo() {
		return tranSeqNo;
	}

	public void setTranSeqNo(String tranSeqNo) {
		this.tranSeqNo = tranSeqNo;
	}

	@Column(name = "MRCHBRCHNO")
	public String getMrchBrchNo() {
		return mrchBrchNo;
	}

	public void setMrchBrchNo(String mrchBrchNo) {
		this.mrchBrchNo = mrchBrchNo;
	}

	@Column(name = "MRCHBRCHNAME")
	public String getMrchBrchName() {
		return mrchBrchName;
	}

	public void setMrchBrchName(String mrchBrchName) {
		this.mrchBrchName = mrchBrchName;
	}

	@Column(name = "MRCHTELLERNO")
	public String getMrchTellerNo() {
		return mrchTellerNo;
	}

	public void setMrchTellerNo(String mrchTellerNo) {
		this.mrchTellerNo = mrchTellerNo;
	}

	@Column(name = "MRCHTELLERNAME")
	public String getMrchTellerName() {
		return mrchTellerName;
	}

	public void setMrchTellerName(String mrchTellerName) {
		this.mrchTellerName = mrchTellerName;
	}

	@Column(name = "MRCHPRODDETAILNUM")
	public Integer getMrchProdDetailNum() {
		return mrchProdDetailNum;
	}

	public void setMrchProdDetailNum(Integer mrchProdDetailNum) {
		this.mrchProdDetailNum = mrchProdDetailNum;
	}

	@Column(name = "MRCHOTHERPAIDAMOUNT")
	public BigInteger getMrchOtherPaidAmount() {
		return mrchOtherPaidAmount;
	}

	public void setMrchOtherPaidAmount(BigInteger mrchOtherPaidAmount) {
		this.mrchOtherPaidAmount = mrchOtherPaidAmount;
	}

	@Column(name = "MRCHAMOUNT")
	public BigInteger getMrchAmount() {
		return mrchAmount;
	}

	public void setMrchAmount(BigInteger mrchAmount) {
		this.mrchAmount = mrchAmount;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getTranDate(), getTranSeqNo() });
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof MchAddTradSummary))
			return false;
		MchAddTradSummary other = (MchAddTradSummary) obj;
		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;
		if (!PCPSUtil.compareObject(this.getTranDate(), other.getTranDate()))
			return false;
		return PCPSUtil
				.compareObject(this.getTranSeqNo(), other.getTranSeqNo());
	}
}
